﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLNhaSach;
using Entities;
using System.Data;

namespace DataAccessLayer
{
    public class BaoCaoTonDAL
    {
        DataService ds = new QLNhaSach.DataService();
        public int InsertBaoCaoTon(BaoCaoTon bct)
        {
            int kq = 0;
            try
            {
                String sql = "INSERT INTO BAOCAOTON(BCT_THANG,BCT_NAM) VALUES('" + bct.Thang + "','" + bct.Nam + "') SELECT @@Identity";
                kq = int.Parse(ds.ExcuteQuery(sql).ToString());
            }
            catch (Exception)
            {
                throw;
            }
            return kq;
        }
        public DataTable layDanhSachBaoCaoTon()
        {
            DataTable DT = new DataTable();
            try
            {
                string sql = "SELECT * FROM BAOCAOTON, CHITIETBAOCAOTON WHERE BCT_MABAOCAOTON = CTBCT_MABAOCAOTON";
                DT = ds.GetTable(sql);
            }
            catch (Exception)
            {
                throw;
            }
            return DT;
        }
    }
}
